package com.zch.work.controller;

import com.baomidou.mybatisplus.extension.api.R;
import com.zch.domain.Result;
import com.zch.entity.TbOperate;
import com.zch.work.service.TbOperateService;
import com.zch.work.vo.DeletedVo;
import com.zch.work.vo.OperateVo;
import io.swagger.annotations.Api;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

/**
 * @author 28763 操作内容维护表
 * @version 1.0
 * @description: TODO
 * @date 2023/10/30 20:03
 */
@RestController
@RequestMapping("/operate")
@Api
public class OperateController {
    @Autowired
    TbOperateService tbOperateService;

    /**
    * @description: TODO 删除
    * @author 王志赛
    * @date 2023/10/30 21:43
    * @version 1.0
    */
    @PostMapping("/deletedByID")
    public Result deletedByID(@RequestBody DeletedVo deletedVo){
        return tbOperateService.deletedByID(deletedVo);
    }

    /**
    * @description: TODO 添加
    * @author 王志赛
    * @date 2023/10/30 21:45
    * @version 1.0
    */
    @PostMapping("/save")
    public Result save(@RequestBody TbOperate tbOperate){
        return tbOperateService.addOperate(tbOperate);
    }

    /**
    * @description: TODO 修改
    * @author 王志赛
    * @date 2023/10/31 8:20
    * @version 1.0
    */
    @PostMapping("/update")
    public Result update(@RequestBody TbOperate tbOperate){
        return tbOperateService.updateAll(tbOperate);
    }

    @PostMapping("/select")
    public Result select(@RequestBody OperateVo operateVo){
        return tbOperateService.selectByEligibility(operateVo);
    }


}
